<!-- 报修页面 -->
<template>
  <div class="Repair-container">
    <div class="main">
      <div class="catalogue">
        <div
          class="item"
          :class="{ avative: avativeRef === 1 }"
          @click="selectAvative(1)"
        >
          <p>上传报修</p>
        </div>
        <div
          class="item"
          :class="{ avative: avativeRef === 2 }"
          @click="selectAvative(2)"
        >
          <p>维修记录</p>
        </div>
      </div>
      <div class="component">
        <KeepAlive>
            <component :is="activeComponent" />
        </KeepAlive>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, shallowRef } from "vue";
import Record from "./components/Record.vue";
import Upload from "./components/Upload.vue"

const activeComponent = shallowRef(Upload)
const avativeRef = ref(1);
function selectAvative(index) {
    avativeRef.value = index;
  if(index === 1){
    activeComponent.value = Upload
  } else {
    activeComponent.value = Record
  }

}
</script>

<style lang="less" scoped>
@import "@/styles/var.less";
@import "@/styles/mixin.less";
.Repair-container {
  width: 100%;
  height: 100%;
  position: relative;
  .main {
    .self-center();
    width: 100%;
    height: 90%;
    background-color: @bakeground;
    backdrop-filter: blur(5px);
    box-shadow: 2px 2px 20px #626262;
    border-radius: 10px;
    padding: 20px;
    .catalogue {
      display: flex;
      width: 50%;
      margin: 10px auto;
      justify-content: space-around;
      
      .item {
        cursor: pointer;
        width: 150px;
        height: 60px;
        background: #fff;
        text-align: center;
        line-height: 60px;
        font-size: 25px;
        font-weight: bold;
        border-radius: 0 20px 0 20px;
        position: relative;
        p {
          background: linear-gradient(to right, @frameColor1, @frameColor2);
          -webkit-background-clip: text;
          background-clip: text;
          color: transparent;
        }
      }
      .avative{
        background: linear-gradient(45deg, @frameColor1, @frameColor2);
        p{
          color: #fff;
        }
      }
    }
    .component{
        padding: 10px 0;
        position: relative;
        height:  90%;
    }
  }
}
</style>